// pages/table/table.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    deskAreaList:[],
    deskTopList:[],
    deskAreaId:1001
  },
  //获取餐台
  getDeskTop(){
    wx.request({
      url: 'http://www.szyzit.com:8080/CateringSystem1.0/recruitment/catering/qryDeskTopList.do?method=login',
      method:"POST",
      header: {
        'Content-type': 'application/x-www-form-urlencoded'
      },
      data:{
        deskAreaId:this.data.deskAreaId
      },
      success: (res) => {
        this.setData({
          deskTopList:res.data.responseBody.deskTopList
        })
      },
      fail:(res)=>{
        wx.showToast({
          title: '请求失败',
        })
      }
    })
  },
  //楼层点击
  louClick(e){
    this.setData({
      deskAreaId:e.target.dataset.num
    })
    // console.log(this.data.deskAreaId)
    this.getDeskTop()
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    wx.request({
      url: 'http://www.szyzit.com:8080/CateringSystem1.0/recruitment/catering/qryDeskArea.do?method=login',
      method:'post',
      header: {
        'Content-type': 'application/x-www-form-urlencoded'
      },
      success: (res) => {
        this.setData({
          deskAreaList:res.data.responseBody.deskAreaList
        })
        // console.log(this.data.deskAreaList)
      },
      fail:(res)=>{
        wx.showToast({
          title: '请求失败',
        })
      }
    })
    this.getDeskTop()
  },
  //返回上一页
  toback(){
    wx.navigateBack({
      delta: 1
    })
  },
  //餐台点击跳转
  taiClick(e){
    console.log('dianji',e.currentTarget.dataset)
    wx.navigateTo({
      url: '/pages/menus/menus?deskId='+e.currentTarget.dataset.deskid+'&deskCaption='+e.currentTarget.dataset.deskcaption,
    })
  }

})